package com.mc.algorithm;

import java.util.Scanner;

public class Poker {
	
	private static int[] input;
	private static int[] flag;
	private static int[] output;
	private static char[] operator;
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			input = new int[4];
			flag = new int[4];
			
			for(int i=0;i<4;i++){
				input[i] = trans(sc.next().charAt(0));
			}
			boolean hasSolution =false;
			for(int j=0;j<4;j++){
				output = new int[4];
				operator = new char[3];//记录三个符号
				output[0] = input[j];
				flag[j]=1;
				//递归函数
				boolean res = false;
				res =compute(1,output[0]);
				if(res){
					print();
					hasSolution=true;
					
				}
				flag[j]=0;
			}
			if(!hasSolution)
				System.out.println("NONE");
		}
	}
	public static void print(){
		System.out.print(reverse(output[0]));
		for(int i=0;i<3;i++){
			System.out.print(operator[i]);
			System.out.print(reverse(output[i+1]));
		}
		System.out.println();
	}
	public static char reverse(int a){
		if(a==11)
			return 'J';
		if(a==12)
			return 'Q';
		if(a==13)
			return 'K';
		if(a==1)
			return 'A';
		return (char) (a +'0');
	}
	public static boolean compute(int pos,double sum){
		if(pos==4&&sum==24)//计算出结果
			return true;
			
		for(int i=0;i<4;i++){
			if(flag[i]==0){//这个数还没用过
				flag[i]=1;
				output[pos]=input[i];
				boolean res = false;
				if(!res){
					operator[pos-1]='+';
					res = compute(pos+1,sum+input[i]);
				}
				if(!res){
					operator[pos-1]='-';
					res = compute(pos+1,sum-input[i]);
				}
				if(!res){
					operator[pos-1]='*';
					res = compute(pos+1,sum*input[i]);
				}
				if(!res){
					operator[pos-1]='/';
					res = compute(pos+1,sum/input[i]);
				}
				if(res)//计算得到结果
					return true;
				
				operator[pos-1]=0;
				flag[i]=0;
				output[pos]=0;
			}
		}
		return false;
	}
	public static int trans(char ch){
		
		switch(ch){
		
		case 'A': return 1;
		case 'J': return 11;
		case 'Q': return 12;
		case 'K': return 13;
		
		default: return ch-'0';
		}
	}
	
}
